home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / SAT / SATminimal ƒ / SATminimal.p < prev    next >
Encoding:
Text File  |  1993-09-19  |  1.2 KB  |  42 lines  |  [TEXT/PJMM]

  1. {Minimal demo program, with a few sprites moving back and forth.}
  2.  
  3. program SATminimal;
  4.  
  5.     uses
  6.         SAT, sMySprite;
  7.     var
  8.         gameWind: WindowPtr;
  9.         ignoreSp: SpritePtr;
  10.         l: longint;
  11. begin
  12. {Standard Inits are done by Think Pascal.}
  13.  
  14. {Initialize, using PICTs 128 or 129 as background, Classic-sized drawing area}
  15.     gameWind := InitSAT(128, 129, 512, 322);
  16.  
  17. {Initialize sprite unit(s)}
  18.     InitMySprite;
  19.  
  20. {Show the window and update it.}
  21.     ShowWindow(gameWind);
  22.     SelectWindow(gameWind);
  23.     PeekOffscreen;
  24.  
  25. {Make some sprites}
  26.     ignoreSp := NewSprite(0, 50, 50, @HandleMysprite, @SetupMySprite, nil);
  27.     ignoreSp := NewSprite(0, 100, 100, @HandleMysprite, @SetupMySprite, nil);
  28.     ignoreSp := NewSprite(0, 125, 120, @HandleMysprite, @SetupMySprite, nil);
  29.     ignoreSp := NewSprite(0, 150, 140, @HandleMysprite, @SetupMySprite, nil);
  30.     ignoreSp := NewSprite(0, 200, 180, @HandleMysprite, @SetupMySprite, nil);
  31.     ignoreSp := NewSprite(0, 250, 200, @HandleMysprite, @SetupMySprite, nil);
  32.     ignoreSp := NewSprite(0, 300, 250, @HandleMysprite, @SetupMySprite, nil);
  33.  
  34.     repeat
  35.         l := TickCount;
  36.         RunSAT(true); {Run one frame of animation}
  37.         while l > TickCount - 3 do {Maximize speed to 20 fps}
  38.             ;
  39.     until Button;
  40.  
  41.     SATSoundShutUp; {Always de-allocate the sound channel before quitting!}
  42. end.